<template>
    <div style="height:100%;width:100%;position:relative;">
        <div class="pagetop" ref="buttondiv">
            <table style="width:100%">
                <tr>
                    <td width="889">
                        <table style="width: 889px">
                            <tr>
                                <td width="50">采样时间</td>
                                <td width="270">
                                    <el-date-picker v-model="datetime1" type="date" value-format="yyyy-MM-dd 00:00:00"
                                        size="mini" placeholder="开始日期" :clearable="false" style="width:125px;">
                                    </el-date-picker>
                                    至
                                    <el-date-picker v-model="datetime2" type="date" value-format="yyyy-MM-dd 23:59:59"
                                        size="mini" placeholder="结束日期" :clearable="false" style="width:125px;">
                                    </el-date-picker>
                                </td>
                                <td width="50">分单类别</td>
                                <td width="120">
                                    <el-select v-model="reqgroupval" placeholder="" style="width:120px"
                                        @dblclick.native="popMultipleChk(reqgroupval, 'reqgroupval', reqgroupOption, '分单类别选择')"
                                        filterable clearable>
                                        <el-option v-for="(item, index) in reqgroupOption" :key="index" :value="item.data"
                                            :label="item.display"></el-option>
                                    </el-select>
                                </td>
                                <td width="60">标本工作组</td>
                                <td width="120">
                                    <el-select v-model="labgroupval" placeholder="" style="width:120px"
                                        @dblclick.native="popMultipleChk(labgroupval, 'labgroupval', labgroupOption, '检验工作组选择')"
                                        filterable clearable>
                                        <el-option v-for="(item, index) in labgroupOption" :key="index" :value="item.data"
                                            :label="item.display"></el-option>
                                    </el-select>
                                </td>
                                <td width="50">申请科室</td>
                                <td width="120">
                                    <el-select v-model="labdeptval" placeholder="" style="width:120px"
                                        @dblclick.native="popMultipleChk(labdeptval, 'labdeptval', labdeptOption, '申请科室选择')"
                                        filterable clearable>
                                        <el-option v-for="(item, index) in labdeptOption" :key="index" :value="item.data"
                                            :label="item.display"></el-option>
                                    </el-select>
                                </td>
                            </tr>
                            <tr>
                                <td>时间段</td>
                                <td>
                                    <el-time-picker v-model="timevalue1" value-format="HH:mm" format='HH:mm' size="mini"
                                        placeholder="开始时间" :clearable="true" style="width:125px;">
                                    </el-time-picker>
                                    至
                                    <el-time-picker v-model="timevalue2" value-format="HH:mm" format='HH:mm' size="mini"
                                        placeholder="结束时间" :clearable="true" style="width:125px;">
                                    </el-time-picker>
                                </td>
                                <td>病人类型</td>
                                <td>
                                    <el-select v-model="PTval" placeholder="" style="width:120px"
                                        @dblclick.native="popMultipleChk(PTval, 'PTval', ptvalOption, '病人类型选择')" filterable
                                        clearable>
                                        <el-option v-for="(item, index) in ptvalOption" :key="index" :value="item.data"
                                            :label="item.display"></el-option>
                                    </el-select>
                                </td>
                                <td>人员工作组</td>
                                <td>
                                    <el-select v-model="labgroupid" placeholder="" style="width:120px"
                                        @dblclick.native="popMultipleChk(labgroupid, 'labgroupid', labgroupOption, '检验工作组选择')"
                                        filterable clearable>
                                        <el-option v-for="(item, index) in labgroupOption" :key="index" :value="item.data"
                                            :label="item.display"></el-option>
                                    </el-select>
                                </td>
                                <td width="46">混样统计</td>
                                <td width="115">
                                    <el-select v-model="mixstatval" placeholder="" style="width:120px" clearable>
                                        <el-option value="main" label="按混样条码"></el-option>
                                        <el-option value="detail" label="按混样明细条码"></el-option>
                                    </el-select>
                                </td>
                            </tr>
                            <tr>
                                <td>标本状态</td>
                                <td>
                                    <el-radio-group v-model="reqstat" size="mini">
                                        <el-radio-button label="0">全部</el-radio-button>
                                        <el-radio-button label="1">采样</el-radio-button>
                                        <el-radio-button label="2">已接收</el-radio-button>
                                        <el-radio-button label="3">未接收</el-radio-button>
                                    </el-radio-group>
                                </td>
                                <td>申请项目</td>
                                <td colspan="3">
                                    <el-select v-model="reqitemval" placeholder="" style="width:310px"
                                        @dblclick.native="popMultipleChk(reqitemval, 'reqitemval', reqitemOption, '申请项目选择')"
                                        filterable clearable>
                                        <el-option v-for="(item, index) in reqitemOption" :key="index" :value="item.data"
                                            :label="item.display"></el-option>
                                    </el-select>
                                </td>
                            </tr>
                            <tr>
                                <td>标本类型</td>
                                <td>
                                    <rm-ddl-common datatype="specimen" dataname="标本类型" :appendtobody="true"
                                        v-model="specimenval" width="270px"></rm-ddl-common>
                                </td>
                                <td>采样窗口</td>
                                <td>
                                    <el-select v-model="sampval" placeholder="" style="width:120px"
                                        @dblclick.native="popMultipleChk(sampval, 'sampval', sampOption, '采样窗口选择')" filterable
                                        clearable>
                                        <el-option v-for="(item, index) in sampOption" :key="index" :value="item.data"
                                            :label="item.display"></el-option>
                                    </el-select>
                                </td>
                                <td>送出人员</td>
                                <td>
                                    <el-select v-model="senduserval" placeholder="" style="width:120px"
                                        @dblclick.native="popMultipleChk(senduserval, 'senduserval', senduserOption, '送出人员选择')"
                                        filterable clearable>
                                        <el-option v-for="(item, index) in senduserOption" :key="index" :value="item.data"
                                            :label="item.display"></el-option>
                                    </el-select>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                        <table>
                            <tr>
                                <td>
                                    <el-checkbox v-model="groupnameflag"
                                        @change="ColumnChange($event, 'req_groupname', '分单类别')">分单类别</el-checkbox>
                                </td>
                                <td>
                                    <el-checkbox v-model="pattypeflag"
                                        @change="ColumnChange($event, 'codena', '病人类型')">病人类型</el-checkbox>
                                </td>
                                <td>
                                    <el-checkbox v-model="specflag"
                                        @change="ColumnChange($event, 'specimen_name', '标本类型')">标本类型</el-checkbox>
                                </td>
                                <td colspan="2">
                                    <el-checkbox v-model="labgroupflag"
                                        @change="ColumnChange($event, 'labgroupname', '分单类别所属检验组')">分单类别所属检验组</el-checkbox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <el-checkbox v-model="itemnameflag"
                                        @change="ColumnChange($event, 'req_itemname', '项目')">项目</el-checkbox>
                                </td>
                                <td>
                                    <el-checkbox v-model="collectuserflag"
                                        @change="ColumnChange($event, 'collectuser', '采样人')">采样人</el-checkbox>
                                </td>
                                <td>
                                    <el-checkbox v-model="yearflag"
                                        @change="ColumnChange($event, 'year', '年')">年</el-checkbox>
                                </td>
                                <td>
                                    <el-checkbox v-model="monthflag"
                                        @change="ColumnChange($event, 'month', '月')">月</el-checkbox>
                                </td>
                                <td>
                                    <el-checkbox v-model="dayflag" @change="ColumnChange($event, 'day', '日')">日</el-checkbox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <el-checkbox v-model="deptnoflag"
                                        @change="ColumnChange($event, 'deptname', '申请科室')">申请科室</el-checkbox>
                                </td>
                                <td>
                                    <el-checkbox v-model="sampflag"
                                        @change="ColumnChange($event, 'windowname', '采样窗口')">采样窗口</el-checkbox>
                                </td>
                                <td>
                                    <el-checkbox v-model="senduserflag"
                                        @change="ColumnChange($event, 'senduser', '送出人')">送出人</el-checkbox>
                                </td>
                                <td colspan="2">
                                    <el-checkbox v-model="computeripflag"
                                        @change="ColumnChange($event, 'computerip', '采样电脑IP')">采样电脑IP</el-checkbox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <table>
                            <tr>
                                <td width="2000px"></td>
                                <td>
                                    <el-button icon="el-icon-search" type="primary" @click="FindData()"
                                        v-has="'PINQUERY'">查询</el-button>
                                </td>
                                <td>
                                    <el-button icon="el-icon-files" @click="btnExport()" v-has="'PEXPORT'">导出</el-button>
                                </td>
                                <td>
                                    <el-button icon="el-icon-printer" @click="printrecord(1)"
                                        v-has="'PPRINT'">打印</el-button>
                                </td>
                                <td>
                                    <el-button icon="el-icon-printer" @click="printrecord(2)"
                                        v-has="'PPRINT'">打印样式设计</el-button>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <div class="pagecenter">
            <div class="middle-center" ref="xTableDiv" style="height:100%;">
                <div style="height:100%">
                    <vxe-table :data="tableData" :loading="loading" :keyboard-config="keyConfig"
                        :keyboard-local-config="keyLocalConfig" :select-config="selectConfig"
                        :sort-config="{ trigger: 'cell' }" :edit-config="{ trigger: 'click', mode: 'cell' }"
                        class="editable-footer" :footer-method="footerMethod" :footer-cell-class-name="footerCellClassName"
                        @current-change="currentChangeEvent" border fit height="auto" header-align="center"
                        highlight-current-row highlight-hover-row highlight-hover-column show-footer ref="xTable" resizable
                        show-header-overflow="tooltip" show-overflow="tooltip" size="mini" stripe>
                        <vxe-table-column :key="item.field" :field="item.field" :width="item.width" :title="item.title"
                            v-for="item in tableColumn"></vxe-table-column>
                        <vxe-table-column key="cp_samplecnt" field="cp_samplecnt" width="70" title="标本数"></vxe-table-column>
                        <vxe-table-column key="cp_cnt" field="cp_cnt" width="70" title="项次"></vxe-table-column>
                        <vxe-table-column key="cp_rs" field="cp_rs" width="70" title="人次"></vxe-table-column>
                        <vxe-table-column key="cp_renshu" field="cp_renshu" width="70" title="人数"></vxe-table-column>
                        <vxe-table-column key="mix_renshu" field="mix_renshu" width="70" title="混采人数"></vxe-table-column>
                        <vxe-table-column key="single_renshu" field="single_renshu" width="70"
                            title="单采人数"></vxe-table-column>
                    </vxe-table>
                </div>
            </div>
        </div>
        <!--多选弹窗--->
        <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false"
            :title="multichktitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
            <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname"
                @change="closedialog"></rm-SqlMultiple>
        </el-dialog>
    </div>
</template>

<script>
// import { parse } from "path";
import XEUtils from "xe-utils";
export default {
    name: "REQ147",
    data() {
        return {
            datetime1: "",
            datetime2: "",
            timevalue1: "",
            timevalue2: "",
            reqgroupval: "",
            labgroupval: "",
            specimenval: "",
            labdeptval: "",
            reqitemval: "",
            mixstatval: "",
            sampval: "",
            senduserval: "",
            PTval: "",
            reqstat: "0",
            labgroupid: "",
            groupnameflag: false,
            pattypeflag: false,
            specflag: false,
            labgroupflag: false,
            collectuserflag: false,
            senduserflag: false,
            computeripflag: false,
            yearflag: false,
            monthflag: false,
            dayflag: false,
            deptnoflag: false,
            sampflag: false,
            itemnameflag: false,

            keyConfig: {
                isDel: true,
                isTab: true,
                isEdit: true,
            },
            keyLocalConfig: {
                isArrow: true,
            },
            selectConfig: { tigger: "row" },
            loading: false,
            loadingDetail: false,
            tableData: [],
            tableDataAll: [],
            tableDataDetail: [],
            tableColumn: [],
            tableColumnDetail: [],
            totalData: [],

            CancelVisible: false,
            reqmaster: {},
            reqitem: "",
            patno: "",
            UpPatno: "",
            noArray: [],
            SmallSumData: [],
            BigSumData: [],
            reqgroupOption: [],
            dialogMultipleVisible: false,
            fieldname: "",
            option2: [],
            option1: [],
            multichktitle: "",
            labgroupOption: [],
            ptvalOption: [],
            labdeptOption: [],
            reqitemOption: [],
            sampOption: [],
            senduserOption: [],
        };
    },
    created() {
        this.InitPageData();
        this.ddlInitData(); //初始化下拉框的数据
    },
    mounted() { },
    updated() { },
    methods: {
        currentChangeEvent({ row }) {
            this.reqmaster = row;
        },
        InitPageData() {
            var day1 = new Date();
            day1.setTime(day1.getTime());
            var s1 = day1.getFullYear() + "-" + (day1.getMonth() + 1) + "-" + day1.getDate() + " 23:59:59";
            var day2 = new Date();
            day2.setTime(day2.getTime() - 24 * 60 * 60 * 1000 * 7);
            var s2 = day2.getFullYear() + "-" + (day2.getMonth() + 1) + "-" + day2.getDate() + " 00:00:00";
            this.datetime1 = s2;
            this.datetime2 = s1;
        },
        ddlInitData() {
            this.$tool
                .request({
                    url: "REQ/REQ1/REQ147",
                    method: "post",
                    data: {
                        action: "ddlInitData"
                    }
                })
                .then(res => {
                    this.reqgroupOption = res.reqgroupOption;
                    this.labgroupOption = res.labgroupOption;
                    this.ptvalOption = res.ptvalOption;
                    this.labdeptOption = res.labdeptOption;
                    this.reqitemOption = res.reqitemOption;
                    this.sampOption = res.sampOption;
                    this.senduserOption = res.senduserOption;
                });
        },
        popMultipleChk(e, fieldname, option, title) {
            let temp = XEUtils.clone(option, true);
            this.option1 = [];
            this.option2 = [];
            if (e != "") {
                let k = e.split(",");
                k.forEach(item => {
                    let ndata = temp.find(m => m.data == item);
                    if (ndata != undefined && ndata != null) {
                        this.option2.push(ndata);
                    }
                });
                temp.forEach(item => {
                    if (k.indexOf(item.data + "") < 0) {
                        this.option1.push(item);
                    }
                });
            } else {
                this.option1 = temp;
            }
            this.fieldname = fieldname;
            this.multichktitle = title;
            this.dialogMultipleVisible = true;
        },
        closedialog(value, name) {
            if (value != "close") {
                this[name] = value;
            }
            this.dialogMultipleVisible = false;
        },
        FindData() {
            if (this.tableColumn.length > 0) {
                this.loading = true;
                this.$tool
                    .request({
                        url: "REQ/REQ1/REQ147",
                        method: "post",
                        data: {
                            action: "query",
                            groupnameflag: this.groupnameflag ? 1 : 0,
                            itemnameflag: this.itemnameflag ? 1 : 0,
                            deptnoflag: this.deptnoflag ? 1 : 0,
                            sampflag: this.sampflag ? 1 : 0,
                            pattypeflag: this.pattypeflag ? 1 : 0,
                            collectuserflag: this.collectuserflag ? 1 : 0,
                            senduserflag: this.senduserflag ? 1 : 0,
                            computeripflag: this.computeripflag ? 1 : 0,
                            specflag: this.specflag ? 1 : 0,
                            labgroupflag: this.labgroupflag ? 1 : 0,
                            yearflag: this.yearflag ? 1 : 0,
                            monthflag: this.monthflag ? 1 : 0,
                            dayflag: this.dayflag ? 1 : 0,
                            reqstat: this.reqstat,
                            pattype: this.PTval,
                            specgroup: this.labgroupval,
                            specimen: this.specimenval,
                            deptno: this.labdeptval,
                            sampval: this.sampval,
                            senduserval: this.senduserval,
                            reqitemval: this.reqitemval,
                            mixstatval: this.mixstatval,
                            reqgroupid: this.reqgroupval,
                            membergroup: this.labgroupid,
                            begindate: this.datetime1,
                            enddate: this.datetime2,
                            timevalue1: this.timevalue1,
                            timevalue2: this.timevalue2,
                            selectColumn1: this.tableColumn.length > 0 ? this.tableColumn[0].field : "",
                            selectColumn2: this.tableColumn.length > 1 ? this.tableColumn[1].field : "",
                        },
                    })
                    .then((res) => {
                        this.tableData = this.DealDataStatic(res.Data, res.Data2, res.Data1);
                        this.totalData = res.Data0;
                        this.loading = false;
                    });
            }
            else {
                this.$message.warning("请选择查询列");
            }
        },
        btnExport() {
            // let options = {
            //     filename: "REQ147 采样综合统计",
            // };
            // this.$refs.xTable.exportCsv(options);
            //改为导出xlsx文件
            let tableColumn = this.$refs.xTable.getColumns();
            let extableColumn = [];
            tableColumn.forEach((item) => {
                extableColumn.push({ title: item.title, field: item.property });
            });
            let footerData = {};
            extableColumn.forEach((item, index) => {
                if (index === 0) {
                    footerData[item.field] = "总计";
                }
                if (["cp_samplecnt", "cp_cnt", "cp_rs", "cp_renshu", "mix_renshu", "single_renshu"].includes(item.field)) {
                    footerData[item.field] = XEUtils.sum(this.totalData, item.field);
                }
            });
            let datas = XEUtils.clone(this.tableData, true);
            datas.push(footerData);
            let filtertxt = this.getExportFilter();
            this.$pub.exportTableExcel(datas, extableColumn, "REQ147 采样综合统计.xlsx", filtertxt, "统计条件：");
        },
        // 获取当前导出文件的所有统计条件
        getExportFilter() {
            let filtertxt = "采样时间" + ":" + this.datetime1 + "至" + this.datetime2 + "; ";
            if (this.reqgroupval) filtertxt += "分单类别:" + this.getOptionName(this.reqgroupOption.filter((item) => ("," + this.reqgroupval + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            if (this.labgroupval) filtertxt += "标本工作组:" + this.getOptionName(this.labgroupOption.filter((item) => ("," + this.labgroupval + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            if (this.labdeptval) filtertxt += "申请科室:" + this.getOptionName(this.labdeptOption.filter((item) => ("," + this.labdeptval + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            if (this.timevalue1) "时间段" + ":" + this.timevalue1 + "至" + this.timevalue2, "yyyy-MM-dd" + "; ";
            if (this.PTval) filtertxt += "病人类型:" + this.getOptionName(this.ptvalOption.filter((item) => ("," + this.PTval + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            if (this.labgroupid) filtertxt += "人员工作组:" + this.getOptionName(this.labgroupOption.filter((item) => ("," + this.labgroupid + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            if (this.mixstatval) {
                if (this.mixstatval == 'main') {
                    filtertxt += "混样统计:按混样条码; ";
                }
                else if (this.mixstatval == 'detail') {
                    filtertxt += "混样统计:按混样明细条码; ";
                }
            }
            if (this.reqstat) {
                if (this.reqstat == '0') {
                    filtertxt += "标本状态:全部; ";
                }
                else if (this.reqstat == '1') {
                    filtertxt += "标本状态:采样; ";
                }
                else if (this.reqstat == '2') {
                    filtertxt += "标本状态:已接收; ";
                }
                else if (this.reqstat == '3') {
                    filtertxt += "标本状态:未接收; ";
                }
            }
            if (this.reqitemval) filtertxt += "申请项目:" + this.getOptionName(this.reqitemOption.filter((item) => ("," + this.reqitemval + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            if (this.specimenval) filtertxt += "标本类型:" + this.specimenval + "; ";
            if (this.sampval) filtertxt += "采样窗口:" + this.getOptionName(this.sampOption.filter((item) => ("," + this.sampval + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            if (this.senduserval) filtertxt += "送出人员:" + this.getOptionName(this.senduserOption.filter((item) => ("," + this.senduserval + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            return filtertxt;
        },
        getOptionName(option) {
            if (option && option.length > 0) {
                let optionname = "";
                option.forEach((item) => {
                    if (item.hasOwnProperty("display")) {
                        optionname += item.display + ",";
                    } else {
                        optionname += item.label + ",";
                    }
                });
                return optionname.substring(0, optionname.length - 1);
            } else {
                return "";
            }
        },
        Clear() {
            this.tableData = [];
            this.tableDataDetail = [];
            this.barcode = "";
            this.datetime1 = "";
            this.datetime2 = "";
            this.patname = "";
            this.patno = "";
            this.cardno = "";
            this.collectbarcode = "";
        },
        ColumnChange(event, field, title) {
            var onecolumn = { field: field, title: title, width: "120" };
            this.tableData = [];
            this.totalData = [];
            if (event) {
                this.tableColumn.push(onecolumn);
            } else {
                this.tableColumn = this.tableColumn.filter((item) => item.field != field);
            }
        },
        footerMethod({ columns, data }) {
            return [
                columns.map((column, columnIndex) => {
                    if (columnIndex === 0) {
                        return "总计";
                    }
                    if (["cp_samplecnt"].includes(column.property)) {
                        return this.SumAll(this.totalData, column.property);
                        //return this.$utils.sum(data, column.property);
                    }
                    if (["cp_cnt"].includes(column.property)) {
                        return this.SumAll(this.totalData, column.property);
                    }
                    if (["cp_rs"].includes(column.property)) {
                        return this.SumAll(this.totalData, column.property);
                    }
                    if (["cp_renshu"].includes(column.property)) {
                        return this.SumAll(this.totalData, column.property);
                    }
                    if (["mix_renshu"].includes(column.property)) {
                        return this.SumAll(this.totalData, column.property);
                    }
                    if (["single_renshu"].includes(column.property)) {
                        return this.SumAll(this.totalData, column.property);
                    }
                    return null;
                }),
            ];
        },
        footerCellClassName({ $rowIndex, column, columnIndex }) { },
        SumAll(data, property) {
            var plus = 0;
            if (data) {
                for (let i = 0, len = data.length; i < len; i++) {
                    plus += data[i][property] - 0;
                }
            }

            return plus;
        },
        printrecord(index) {
            var data = this.$refs.xTable.afterFullData;
            if (data.length > 0) {
                const rload = this.$pub.openLoading(this, "正在打开报表设计器，请稍候……");
                let column = this.$refs.xTable.getTableColumn().tableColumn;
                let str = JSON.stringify(this.$pub.InitColumn(column));
                str += "\r";
                str += JSON.stringify(data);
                let sql = btoa(encodeURIComponent(str));
                if (index == "1") {
                    jsObj.PrintCustomJsonReport("5058", sql, this.$tool.getSession(this.$tool.loginuserno), "采样综合统计打印", "");
                } else {
                    jsObj.SetCustomJsonPrintConfig("5058", sql, this.$tool.getSession(this.$tool.loginuserno), "采样综合统计打印");
                }
                rload.close();
            } else {
                this.$message.error("错误：没有要打印的数据！");
            }
        },
        DealDataStatic(all, second, first) {
            var redata = [];
            if (this.tableColumn.length == 1) {
                redata = all;
            }
            if (this.tableColumn.length == 2) {
                if (first) {
                    for (let i = 0; i < first.length; i++) {
                        var property1 = this.tableColumn[0].field;
                        var tempdata = all.filter((item) => item[property1] == first[i][property1]);
                        for (let j = 0, len = tempdata.length; j < len; j++) {
                            redata.push(tempdata[j]);
                        }
                        first[i][this.tableColumn[1].field] = "合计";
                        first[i][this.tableColumn[0].field] = "";
                        redata.push(first[i]);
                    }
                }
            }
            if (this.tableColumn.length > 2) {
                var redatatemp = [];
                if (second) {
                    for (let i = 0; i < second.length; i++) {
                        var property1 = this.tableColumn[0].field;
                        var property2 = this.tableColumn[1].field;
                        var tempdata = all.filter((item) => item[property1] == second[i][property1] && item[property2] == second[i][property2]);
                        for (let j = 0, len = tempdata.length; j < len; j++) {
                            redatatemp.push(tempdata[j]);
                        }
                        second[i][this.tableColumn[2].field] = "小计";
                        second[i][this.tableColumn[1].field] = "";
                        redatatemp.push(second[i]);
                    }
                }
                if (first) {
                    for (let i = 0; i < first.length; i++) {
                        var property1 = this.tableColumn[0].field;
                        var tempdata = redatatemp.filter((item) => item[property1] == first[i][property1]);
                        for (let j = 0, len = tempdata.length; j < len; j++) {
                            redata.push(tempdata[j]);
                        }
                        first[i][this.tableColumn[1].field] = "合计";
                        first[i][this.tableColumn[0].field] = "";
                        redata.push(first[i]);
                    }
                    var tablexiao = redata.filter((item) => item[this.tableColumn[2].field] == "小计");
                    for (let i = 0; i < tablexiao.length; i++) {
                        tablexiao[i][this.tableColumn[0].field] = "";
                    }
                }
            }
            return redata;
        },
    },
};
</script>
<style scoped>
::v-deep .vxe-input--wrapper .vxe-input {
    height: auto;
    width: 200px;
    border-radius: 0px;
}

::v-deep .el-button--default.btn-custom-cancel {
    float: right !important;
    margin-left: 10px;
}

.pagetop {
    left: 0;
    right: 0;
    height: 180px;
    display: -webkit-box;
    -webkit-box-pack: center;
    -webkit-box-align: center;
    border: solid 1px #ccc;
    position: absolute;
    z-index: 99;
}

.pagecenter {
    position: absolute;
    top: 184px;
    width: 100%;
    left: 0;
    bottom: 0px;
    overflow: auto;
}

.middle-center {
    position: absolute;
    height: 100%;
    right: 0;
    left: 0;
}

.middle-right {
    position: absolute;
    top: 0;
    bottom: 2px;
    width: 300px;
    right: 0px;
}

table {
    font-size: 12px;
    border-collapse: separate;
    border-spacing: 5px;
}

::v-deep .el-checkbox__inner::after {
    border: 2px solid #000000 !important;
    box-sizing: content-box;
    content: "";
    border-left: 0 !important;
    border-top: 0 !important;
    height: 7px;
    left: 4px;
    position: absolute;
    top: 1px;
    transform: rotate(45deg) scaleY(0);
    width: 3px;
    transition: transform 0.15s ease-in 0.05s;
    transform-origin: center;
}

::v-deep .el-checkbox__input.is-disabled+span.el-checkbox__label {
    color: #000000;
    cursor: not-allowed;
}

::v-deep .el-checkbox__input.is-disabled .el-checkbox__inner,
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner+.el-input.is-disabled .el-input__inner {
    background-color: #ffffff !important;
}</style>